﻿

namespace Mulala.Cavan.Presentation.Mvc.ViewModel
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Mulala.Cavan.Presentation.Seedwork;
    using Mulala.Cavan.Domain.MainBoundedContext.SecurityModule;
    using Mulala.Cavan.Domain.MainBoundedContext.SearchModule;
    using FluentValidation;
    using FluentValidation.Attributes;
    using Mulala.Cavan.Presentation.Mvc.Controller.Resources;

    [Serializable]
    [Validator(typeof(UserAccountViewModelValidator))]
    public class UserAccountViewModel : EntityModel<UserAccount, UserAccountSearch>, IUserAccountViewModel
    {
        public int RegisterRoleID { get; set; }
        public string LoginUserName { get; set; }
        public bool AutoLogin { get; set; }
    }

    public class UserAccountViewModelValidator : AbstractValidator<UserAccountViewModel>
    {
        public UserAccountViewModelValidator()
        {
            RuleFor(ua => ua.LoginUserName).NotEmpty().WithMessage(Messages.Validate_LoginUserNameIsInvalid).Length(2, 20).WithMessage(Messages.Validate_LoginUserNameIsInvalid);
        }
    }
}
